package com.company;

import java.util.Scanner;

/**
 * @author zhangjian
 * @data 2023/3/18
 * @Version 1.0
 * @Descripion
 */
public class HJ35蛇形矩阵 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int temp = 1;
        int[][] array = new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j <= i; j++) {
                if (j == 0) {
                    array[i][j] = temp;
                    temp++;
                } else {
                    array[i - j][j] = temp;
                    temp++;
                }
            }
        }

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {
                if (array[i][j] !=0){
                    System.out.print(array[i][j]+" ");
                }
            }
            System.out.println();
        }
    }
}
